/***************************************************************************
创建者：华磊
开始时间：               : 2020.11.1
copyright            : (C) 深圳市华友高科有限公司
修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

修改人:华磊
开始时间:2020.11.28
修改描述:delegate整合,工程整合

 ***************************************************************************
 *   示教器主程序
 *                                                                         *
 ***************************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

//通信
#include "../CommunicateDelegate/globaldata.h"
#include "../CommunicateDelegate/moveoperation.h"
//#include "../CommunicateDelegate/hmicommunicate.h" //移交delegate处理
#include "../CommunicateDelegate/communicatedelegate.h"

//硬件驱动(原本是仅在STM32下编译:现在支持热拔插)
#ifdef BUILD_ARM
#include "../DeviceDriver/devicedriver.h"
#endif

#ifdef BUILD_ARM
//热拔插
#include "hotplugwatcher.h"
#endif

//消息
#include "hmimessageboxdialog.h"
#include "hmifilmlabel.h"

//界面
#include "../login1/login.h"
#include "../delegate1/delegate.h"
#include "../delegate1/ftpdelegate.h"

#include "../leftview/leftview.h"
#include "../leftviewdelegate/leftviewdelegate.h"
#include "../leftfun/leftfun.h"
#include "../leftfundelegate/leftfundelegate.h"
#include "../rightfun/rightfun.h"
#include "../rightfundelegate/rightfundelegate.h"
#include "../rightview/rightview.h"
#include "../rightviewdelegate/rightviewdelegate.h"
#include "../topview/topview.h"
#include "../topviewdelegate/topviewdelegate.h"
#include "../bottomview/bottomview.h"
#include "../bottomviewdelegate/bottomviewdelegate.h"

#include "../MiddleViewDelegate/middleviewdelegate.h"
#include "../RunView/runview.h"
#include "../RunDelegate/rundelegate.h"
#include "../JogView/jogview.h"
#include "../JogDelegate/jogdelegate.h"
#include "../programView/programview.h"
#include "../programDelegate/programdelegate.h"
#include "../systemstatus/systemstatus.h"
#include "../systemstatusdelegate/systemstatusdelegate.h"
#include "../messageView/messageview.h"
#include "../messageDelegate/messagedelegate.h"

#include "../programFileView/programfileview.h"
#include "../programFileDelegate/programfiledelegate.h"
#include "../HomeMenuView/homemenuview.h"
#include "../HomeMenuDelegate/homemenudelegate.h"
#include "../MultiRobotControlDlg/multirobotcontroldlg.h"
#include "../RobotSettingDlg/robotsettingdlg.h"

#include "../FtpManage/ftpprogressdialog.h"

#include <QKeyEvent>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(int styleId, GlobalData *globalDataIn, GlobalData *ioDataIn,
               QWidget *parent = 0);
    ~MainWindow();

    void setShowInitialLanguage(int language);

public:
    bool eventFilter(QObject *obj, QEvent *event);


signals:
    void disableJog_signal();
    /**
     * @brief hideAllTopView            隐藏所有子页面
     */
    void hideAllTopView();

    /**
     * @brief stopRun_signal        停止运行信号:急停
     */
    void stopRun_signal();

    /**
     * @brief pauseRun_signal       暂停运行信号:暂停
     */
    void pauseRun_signal();

public slots:
    /**
     * @brief showMsgBoxTypeSlot        显示(普通)消息框
     * @param msgBoxType                有无按钮的类型
     * @param title                     标题
     * @param text                      内容
     */
    void showMsgBoxTypeSlot(int msgBoxType,QString title,QString text);

    void closeMsgBoxSlot();

    /**
     * @brief showMsgBoxNeedReturnTypeSlot  需要返回值的消息框
     * @param msgBoxType                    返回类型(int double float qstring )
     * @param target                        返回目标
     */
    void showMsgBoxNeedReturnTypeSlot(int msgBoxType,int target,QString title,QString text);

    /**
     * @brief showFilmSlot              显示透明膜
     */
    void showFilmSlot();
    void hideFilmSlot();                //隐藏

    /**
     * @brief changeLanguageSlot        语言切换
     * @param language
     */
    void changeLanguageSlot(int language);

    void showFtpDialog();

private:
    void initialDisplayStyle(int styleId);
public:
    //硬件驱动:获取main()中的指针:主要用于控制键盘的显示与声响
#ifdef BUILD_ARM
    DeviceDriver *deviceDriver;
#endif

private:
    //**********消息框界面**********
    HmiMessageBoxDialog *hmiMsgBox;

    FtpProgressDialog *ftpProgressDialog;

    //**********屏蔽膜
    HmiFilmLabel *film;

    //**********data
    GlobalData *globalData;
    GlobalData *ioData;


private:
    QTranslator translator;

private:
    Ui::MainWindow *ui;

    /**
     * @brief keyEvent          键盘事件对象
     */
    QKeyEvent *keyEvent;

private:
    // 快捷键处理异常, 空格：AGV暂停运行,回车:AGV停止运行
    int shortCutSetStop();
};

#endif // MAINWINDOW_H
